using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace CLZ.Data
{
	public static class TableAreaAddress
	{
		public const string Table = "AreaAddress";
		public const string AreaAddressID = "AreaAddressID";
		public const string AreaID = "AreaID";
		public const string Address = "Address";
	}
	
	[Serializable]
	public class BaseAreaAddress
		: IDbSessionEntity, IJsonClass
	{
		int m_AreaAddressID;
		/// <summary>
        /// 片区地址表ID
        /// </summary>
        public int AreaAddressID
        {
            get { return m_AreaAddressID; }
            set { m_AreaAddressID = value; }
        }
		
		int? m_AreaID;
		/// <summary>
        /// 片区表ID
        /// </summary>
        public int? AreaID
        {
            get { return m_AreaID; }
            set { m_AreaID = value; }
        }
		
		string m_Address;
		/// <summary>
        /// 片区地址
        /// </summary>
        public string Address
        {
            get { return m_Address; }
            set { m_Address = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_AreaAddressID = reader[TableAreaAddress.AreaAddressID];
            m_AreaID = reader[TableAreaAddress.AreaID];
            m_Address = reader[TableAreaAddress.Address];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableAreaAddress.AreaAddressID, PrimaryKeyType.Identity, AreaAddressID);
			writer[TableAreaAddress.AreaID] = AreaID;
			writer[TableAreaAddress.Address] = Address;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_AreaAddressID = idd;
        }
		
		public string TableName
        {
            get { return TableAreaAddress.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_AreaAddressID = hashToRead["AreaAddressID"];
			 
             m_AreaID = hashToRead["AreaID"];
			 
             m_Address = hashToRead["Address"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["AreaAddressID"] = AreaAddressID;
			 
            hashToFill["AreaID"] = AreaID;
			 
            hashToFill["Address"] = Address;
			 
        }

        #endregion
		
	}
}
